

cd "../replication-package"


*----------------------------------------------------------------*
**# ---------- 2. Gender labor force participation gap ----------#
*----------------------------------------------------------------*

*** ratio of men's to women's labor force participation rates, age 18-65 
// following Homan 2019 
// this article nor the original cited article (Kavanagh et al 2017) had the upper limit of the age 
// so I just use 65 
use "data/raw/cps_00088.dta", clear
tab asecflag 

keep if inrange(year, 1982, 2019) // 
keep if inrange(age, 18, 65)
keep if inrange(statefip, 1, 56)
gen state_a = statefip
label define state_a  1 "AL" 2 "AK" 5 "AR" 4 "AZ" 6 "CA" 8 "CO" 9 "CT" 10 "DE" ///
		11 "DC" 12 "FL" 13 "GA" 15 "HI" 16 "ID" 19 "IA" 17 "IL" 18 "IN" 20 "KS" 21 "KY" 22 "LA" ///
		25 "MA" 24 "MD" 23 "ME" 26 "MI" 27 "MN" 29 "MO" 28 "MS" 30 "MT" 37 "NC" 38 "ND" ///
		31 "NE" 33 "NH" 34 "NJ" 35 "NM" 32 "NV" 36 "NY" 39 "OH" 40 "OK" 41 "OR" 42 "PA" ///
		44 "RI" 45 "SC" 46 "SD" 47 "TN" 48 "TX" 49 "UT" 51 "VA" 50 "VT" 53 "WA" 55 "WI" ///
		54 "WV" 56 "WY", replace
label val state_a state_a
fre empstat
recode empstat (1 = .) (10/22 = 1) (30/36 = 0), gen(lfdum_1865)
keep if lfdum_1865!=. 
label var lfdum_1865 "labor force participation status"

preserve 
keep if sex==1 
collapse (mean) lfdum_1865, by(state_a year)
rename lfdum_1865 lf_male_1865 
tempfile lf_male 
save `lf_male'
restore 

keep if sex==2 
collapse (mean) lfdum_1865, by(state_a year)
rename lfdum_1865 lf_fem_1865 
tempfile lf_fem 
save `lf_fem'

use `lf_male', clear 
merge 1:1 state_a year using `lf_fem', gen(m_lf)
tab m_lf 
drop m_lf 
gen lfrategap_1865 = lf_male_1865/lf_fem_1865
label var lfrategap_1865 "Male-to-female lf rate ratio, age 1865"
save "data/state/02_lfrate_ratio.dta", replace 


